package com.zhuhjay.service.system.model.vo;

import com.zhuhjay.common.base.util.BeanBuilder;
import com.zhuhjay.service.system.model.entity.SystemMenu;
import lombok.Data;

import java.util.List;

/**
 * 菜单信息
 *
 * @author ZhuHJay
 * @date 2023/2/15 17:45
 */
@Data
public class MenuInfoVo {

    private Integer id;
    private String menuName;
    private String menuKey;
    private Integer sort;
    private List<MenuInfoVo> children;

    public static MenuInfoVo of(SystemMenu menu) {
        return BeanBuilder.builder(MenuInfoVo::new)
                .with(MenuInfoVo::setId, menu.getId())
                .with(MenuInfoVo::setMenuName, menu.getMenuName())
                .with(MenuInfoVo::setMenuKey, menu.getMenuKey())
                .with(MenuInfoVo::setSort, menu.getSort())
                .build();
    }

}
